package org.qiyu.live.im.core.server.bio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-10-05
 * Time: 23:28
 */
public class BioClient {

    public static void main(String[] args) throws IOException, InterruptedException {
        Socket socket = new Socket();
        // 与9090端口建立连接
        socket.connect(new InetSocketAddress(9090));
        // 得到输出流,把数据推出去,不断地发送数据
        OutputStream outputStream = socket.getOutputStream();
        while (true) {
            outputStream.write("test".getBytes());
            outputStream.flush();
            System.out.println("发送了数据");
            Thread.sleep(1000);
        }
    }
}